package com.lemon.exam.entity.po;

import com.lemon.exam.common.annotation.LogicDelete;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 班级表 持久层对象
 *
 * @author Lemon
 * @since 2025/04/20 22:06:24
 */
@Getter
@Setter
@ToString
@Table(value = "biz_class")
@Schema(name = "班级表")
public class ClassPO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @Id
    @Schema(description = "班级主键ID")
    @Column(value = "id")
    private Long id;

    @Schema(description = "年级ID")
    @Column(value = "grade_id")
    @NotNull(message = "年级不能为空")
    private Long gradeId;

    @Schema(description = "班级名称")
    @Column(value = "name")
    @NotBlank(message = "班级名称不能为空")
    private String name;

    @Schema(description = "门牌号")
    @Column(value = "house_num")
    @NotBlank(message = "门牌号不能为空")
    private String houseNum;

    @Schema(description = "创建人")
    @Column(value = "create_by")
    private String createBy;

    @Schema(description = "创建时间")
    @Column(value = "create_time")
    private LocalDateTime createTime;

    @Schema(description = "修改人")
    @Column(value = "update_by")
    private String updateBy;

    @Schema(description = "修改时间")
    @Column(value = "update_time")
    private LocalDateTime updateTime;

    @Schema(description = "删除：0正常 1删除")
    @Column(value = "deleted")
    @LogicDelete
    private Integer deleted;

    @Schema(description = "年级名称")
    @Transient
    private String gradeName;
}
